package reflect;

import java.lang.reflect.Constructor;

/**
 * @author DBX
 * @effect 利用反射机制调用构造方法
 * @date 2021/09/15/22:11
 */
public class ReflectTest07 {
    public static void main(String[] args)throws Exception {
        Class c = Class.forName("reflect.User");
        c.newInstance();
        Constructor con = c.getConstructor(String.class,String.class,int.class);
        Object obj = con.newInstance("dbx","man",142);
        System.out.println(obj);
    }
}
